import java.util.PriorityQueue;

public class Solution1753 {
    public int maximumScore(int a, int b, int c) {
        PriorityQueue<Integer> priorityQueue=new PriorityQueue<>((x,y)->y-x);
        priorityQueue.offer(a);
        priorityQueue.offer(b);
        priorityQueue.offer(c);
        int ans=0;
        while (true){
            int x=priorityQueue.poll();
            int y=priorityQueue.poll();
            if (y==0){
                return ans;
            }
            ans++;
            priorityQueue.offer(x-1);
            priorityQueue.offer(y-1);
        }
    }

    public static void main(String[] args) {
        System.out.println(new Solution1753().maximumScore(2,4,6));
    }
}
